/*
handle memory error
MemoryErrorError

 */
#include <iostream>
#include <cstdio>
#include <csetjmp>
using namespace std;
class FileError:public exception{
	public:
		virtual const char *what() const throw(){
			cout << "handle file error" << endl;
			return "FileError";
		}
};
class MemoryError:public exception{
	public:
		virtual const char *what() const throw(){
			cout << "handle memory error" << endl;
			return "MemoryErrorError";
		}
};
void func(void) {
	//throw FileError();
	throw MemoryError();
	//throw -1; 
}
int main(void){
	try{
		func();
	}
	catch(exception& ex){
		cout << ex.what()<< endl;
		return -1;
	}
	return 0;
}
